using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using RecruitmentSystem.Business;
using RecruitmentSystem.Common;
using System.Collections.Generic;

public partial class NewsList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int categoryId = Convert.ToInt32(Request.QueryString["categoryid"]);
            BindDataList(categoryId);
            ShowNewsList1.CategoryId = 8;
            ShowNewsList1.ShowSize = 10;
            ShowNewsList1.NewsLength = 14;
            ShowNewsList2.CategoryId = 2;
            ShowNewsList2.NewsLength = 14;
            ShowNewsList2.ShowSize = 13;
        }
    }

    private void BindDataList(int categoryId)
    {
        NewsManager nm = new NewsManager();
        AspNetPager1.RecordCount = nm.GetNewsCountByCategoryId(categoryId);
        DataList1.DataSource = nm.GetNewsByCategoryId(categoryId, AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex);
        DataList1.DataBind();
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        int categoryId = Convert.ToInt32(Request.QueryString["categoryid"]);
        BindDataList(categoryId);
    }

}
